
import requests

from common.get_login_token import login_token

id = '1524644748147621888'
token = login_token()
# 添加员工
url = "http://ihrm-test.itheima.net/api/sys/user"
json_data={"username":"张山","mobile":"13488888888","workNumber":"123456789012"}
headers = {"Authorization":token}
resp = requests.post(url=url,headers=headers,json=json_data)
print('添加员工:',resp.json())
# 修改员工
url = "http://ihrm-test.itheima.net/api/sys/user/"+ id
json_data={"username":"didi"}
headers = {"Authorization":token}
resp = requests.put(url=url,headers=headers,json=json_data)
print('修改员工:',resp.json())
# 删除员工
url = "http://ihrm-test.itheima.net/api/sys/user/"+ id
headers = {"Authorization":token}
resp = requests.delete(url=url,headers=headers)
print('删除员工:',resp.json())
# 查询员工
url = "http://ihrm-test.itheima.net/api/sys/user/"+ id
headers = {"Authorization":token}
resp = requests.get(url=url,headers=headers)
print('查询员工:',resp.json())
